#!/usr/bin/env bash

if
  [[ -f "/etc/gentoo-release" ||
    "${RUBYOPT:-}" =~ "-rauto_gem"
  ]]
then
  typeset __sitelib
  __sitelib="$( $rvm_ruby_binary -rrbconfig -e "puts RbConfig::CONFIG['sitelibdir']" )"
  if [[ -n "${__sitelib}" ]]
  then touch "${__sitelib}/auto_gem.rb"
  else echo "WARN: Installed ruby does not have valid 'sitelibdir', no 'auto_gem.rb' was created, please report a bug here: https://github.com/rvm/rvm/issues"
  fi
fi
